home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / basic2-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.9 KB  |  115 lines

  1. ;  HIGHLIGHT-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a background with a drop shadow and a highlight
  3.  
  4. (define (color-highlight color)
  5.   (let ((r (car color))
  6.     (g (cadr color))
  7.     (b (caddr color)))
  8.  
  9.     (set! r (+ r (* (- 255 r) 0.75)))
  10.     (set! g (+ g (* (- 255 g) 0.75)))
  11.     (set! b (+ b (* (- 255 b) 0.75)))
  12.     (list r g b)))
  13.  
  14. (define (apply-basic2-logo-effect img
  15.                   logo-layer
  16.                   bg-color
  17.                   text-color)
  18.   (let* ((width (car (gimp-drawable-width logo-layer)))
  19.      (height (car (gimp-drawable-height logo-layer)))
  20.      (posx (- (car (gimp-drawable-offsets logo-layer))))
  21.      (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  22.      (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  23.      (highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
  24.      (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
  25.  
  26.     (gimp-context-push)
  27.  
  28.     (gimp-selection-none img)
  29.     (script-fu-util-image-resize-from-layer img logo-layer)
  30.     (gimp-image-add-layer img bg-layer 1)
  31.     (gimp-image-add-layer img shadow-layer 1)
  32.     (gimp-image-add-layer img highlight-layer 1)
  33.     (gimp-context-set-foreground text-color)
  34.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  35.     (gimp-edit-fill logo-layer FOREGROUND-FILL)
  36.     (gimp-edit-clear shadow-layer)
  37.     (gimp-context-set-foreground (color-highlight text-color))
  38.     (gimp-layer-set-preserve-trans highlight-layer TRUE)
  39.     (gimp-edit-fill highlight-layer FOREGROUND-FILL)
  40.     (gimp-context-set-background bg-color)
  41.     (gimp-drawable-fill bg-layer BACKGROUND-FILL)
  42.     (gimp-selection-layer-alpha logo-layer)
  43.     (gimp-context-set-background '(0 0 0))
  44.     (gimp-selection-feather img 7.5)
  45.     (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  46.     (gimp-selection-none img)
  47.     (gimp-context-set-foreground '(255 255 255))
  48.  
  49.     (gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
  50.              GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
  51.              FALSE 0 0 TRUE
  52.              0 0 width height)
  53.  
  54.     (gimp-layer-translate shadow-layer 3 3)
  55.     (gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
  56.     (gimp-drawable-set-name highlight-layer "Highlight")
  57.  
  58.     (gimp-context-pop)))
  59.  
  60. (define (script-fu-basic2-logo-alpha img
  61.                      logo-layer
  62.                      bg-color
  63.                      text-color)
  64.   (begin
  65.     (gimp-image-undo-group-start img)
  66.     (apply-basic2-logo-effect img logo-layer bg-color text-color)
  67.     (gimp-image-undo-group-end img)
  68.     (gimp-displays-flush)))
  69.  
  70. (script-fu-register "script-fu-basic2-logo-alpha"
  71.             _"B_asic II..."
  72.             "Creates a simple logo with a shadow and a highlight"
  73.             "Spencer Kimball"
  74.             "Spencer Kimball"
  75.             "1996"
  76.             "RGBA"
  77.                     SF-IMAGE      "Image" 0
  78.                     SF-DRAWABLE   "Drawable" 0
  79.                    SF-COLOR      _"Background color" '(255 255 255)
  80.             SF-COLOR      _"Text color" '(206 6 50))
  81.  
  82. (script-fu-menu-register "script-fu-basic2-logo-alpha"
  83.              _"<Image>/Script-Fu/Alpha to Logo")
  84.  
  85.  
  86. (define (script-fu-basic2-logo text
  87.                    size
  88.                    font
  89.                    bg-color
  90.                    text-color)
  91.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  92.      (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
  93.  
  94.     (gimp-image-undo-disable img)
  95.     (gimp-drawable-set-name text-layer text)
  96.     (apply-basic2-logo-effect img text-layer bg-color text-color)
  97.     (gimp-image-undo-enable img)
  98.     (gimp-display-new img)))
  99.  
  100. (script-fu-register "script-fu-basic2-logo"
  101.             _"B_asic II..."
  102.             "Creates a simple logo with a shadow and a highlight"
  103.             "Spencer Kimball"
  104.             "Spencer Kimball"
  105.             "1996"
  106.             ""
  107.             SF-STRING     _"Text"               "SCRIPT-FU"
  108.             SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
  109.             SF-FONT       _"Font"               "Sans Bold"
  110.             SF-COLOR      _"Background color"   '(255 255 255)
  111.             SF-COLOR      _"Text color"         '(206 6 50))
  112.  
  113. (script-fu-menu-register "script-fu-basic2-logo"
  114.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  115.